package xxm.service.impl;

import java.util.List;

import xxm.dao.IArticleDao;
import xxm.dao.impl.ArticleDaoImpl;
import xxm.exception.ServiceException;
import xxm.model.Article;

public class ArticleManagerImpl implements xxm.service.IArticleManager {

	private IArticleDao articleDao = null;
	
	public IArticleDao getArticleDao() {
		return articleDao;
	}
	public void setArticleDao(IArticleDao articleDao) {
		this.articleDao = articleDao;
	}
	public ArticleManagerImpl() {
		articleDao = new ArticleDaoImpl();
	}
	@Override
	public boolean delete(int id) throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.delete(id);
	}

	@Override
	public boolean delete(Article m) throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.delete(m);
	}

	@Override
	public int getCount() throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.getCount();
	}

	@Override
	public Article loadById(int id) throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.loadById(id);
	}

	@Override
	public List<Article> paging(int pageSize, int pageCount, int rowCount)
			throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.paging(pageSize, pageCount, rowCount);
	}

	@Override
	public boolean save(Article m) throws ServiceException {
		// TODO Auto-generated method stub
		try {
			articleDao.save(m);
		} catch (Exception e ) {
			throw new ServiceException(e);
		}
		return true;
	}

	@Override
	public boolean update(Article m) throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.update(m);
	}
	@Override
	public List<Article> getTableArray() throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.getTableArray();
	}
	@Override
	public List<Article> getTableVectorByName(String strKey)
			throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.getTableVectorByName(strKey);
	}
	@Override
	public List<Article> getTableVectorByCode(String strKey)
			throws ServiceException {
		// TODO Auto-generated method stub
		return articleDao.getTableVectorByCode(strKey);
	}

}
